import sys
import logging
from datetime import datetime
from stock_a.feature.stock_feature_generator import StockFeatureGenerator

if __name__ == '__main__':
    argv_list = sys.argv
    if len(argv_list) < 2:
        logging.error('Please input the biz_date. For example: python feature_daily_executor.py 2025-01-26')
        sys.exit(-1)
    date = datetime.strptime(argv_list[1], '%Y-%m-%d').date()
    label_generator = StockFeatureGenerator()
    label_generator.clear_all_data()
    label_generator.init_tables()
    label_generator.build_or_update_stock_feature(date)